<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>渐变</title>
</head>
<style>
    li {
        width: 100px;
        height: 50px;
        background-color: #ccc;
        position: relative;
        text-align: center;
    }
    a {
        line-height: 50px;
    }
    a::after {
        position: absolute;
        content: '';
        width: 0;
        bottom: 0px;
        left: 50%;
        transform: translateX(-50%);
        height: 3px;
        background: #e78511;
        transition: 0.3s;
        z-index: 1;
    }
    li:hover a::after {
        width: 100%;
    }
</style>
<body>
    <ul>
        <li><a>大王</a></li>
        <li><a>二王</a></li>
        <li><a>小王</a></li>
    </ul>
</body>
</html>